home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1991 …esperately Seeking Seven / Desperately Seeking Seven.2mg / Dev.CD.8 / Essentials / Tools / DTS.Samples / SC02BusyBox / BusyBox.p / UMenu.p < prev    next >
Encoding:
Text File  |  1990-05-25  |  2.7 KB  |  121 lines  |  [04] ASCII Text (0x0000)

  1. {**********************************************************************
  2. {*
  3. {* BusyBox uMenu -- Version 3.0  (interface)
  4. {*
  5. {* Copyright (c)
  6. {* Apple Computer, Inc.  1986-1989
  7. {* All Rights Reserved.
  8. {*
  9. {* Developer Technical Support Apple II Sample Code
  10. {*
  11. {* This file contains the interface to the code which implements 
  12. {* menus in the busybox program.
  13. {*
  14. {**********************************************************************}
  15.  
  16. UNIT uMenu;
  17.  
  18. INTERFACE
  19.  
  20. USES
  21.        types,
  22.        locator,
  23.        quickdraw,
  24.        fonts,
  25.        INTMATH,
  26.        events,
  27.        memory,
  28.        controls,
  29.        gsos,
  30.        windows,
  31.        lineedit,
  32.        dialogs,
  33.        menus,
  34.        desk,
  35.        STDFILE,
  36.        resources,
  37.     
  38.        uGlobals,
  39.        uUtils,
  40.        uWindow;
  41.  
  42.  
  43. procedure DoMenu;      {Execute a menu item}
  44. procedure SetUpMenus;  {Install menus and redraw menu bar}
  45.  
  46.  
  47. IMPLEMENTATION
  48.  
  49. {$R-}
  50.  
  51. procedure DoQuitItem;
  52.  
  53.    {Private routine to set Done flag if the "Quit" item was selected}
  54.  
  55.    begin   {of DoQuitItem}
  56.        Done := true;
  57.    end;    {of DoQuitItem}
  58.  
  59.  
  60.  
  61. procedure DoAboutItem;
  62.     var
  63.         ignore : integer;
  64.    begin   {of DoAboutItem}
  65.         ignore := AlertWindow(4,NIL,Ptr(1));
  66.    end;    {of DoAboutItem}
  67.  
  68.  
  69. procedure DoMenu;
  70.  
  71.    {Procedure to handle all menu selections.  Examines the Event.TaskData
  72.     menu item ID word from TaskMaster (from Event Manager) and calls the
  73.     appropriate routine.  While the routine is running the menu title is
  74.     still highlighted.  After the routine returns, we unhilight the
  75.     menu title.}
  76.  
  77.    var menuNum : integer;
  78.        itemNum : integer;
  79.  
  80.    begin   {of DoMenu}
  81.  
  82.        menuNum := HiWord (Event.wmTaskData);
  83.        itemNum := LoWord (Event.wmTaskData);
  84.    
  85.        case itemNum of
  86.            AboutItem    :  DoAboutItem;
  87.            CloseItem    :  DoCloseTop;
  88.            QuitItem     :  DoQuitItem;
  89.            UndoItem     :  ;
  90.            CutItem      :  ;
  91.            CopyItem     :  ;
  92.            PasteItem    :  ;
  93.            ClearItem    :  ;
  94.        otherwise
  95.            ;
  96.        end;
  97.  
  98.        HiliteMenu (false,menuNum);     {Unhighlight the menu title}{ *** MAX *** }
  99.  
  100.    end;    {of DoMenu}
  101.  
  102.  
  103.  
  104. procedure SetUpMenus;
  105.  
  106.    {Procedure to install our menu titles and their items in the system menu
  107.     bar and to redraw it so we can see them.}
  108.  
  109.    var height : integer;
  110.  
  111.    begin   {of SetUpMenus}
  112.         SetSysBar(NewMenubar2(RefIsResource,ref($1000),NIL));
  113.         SetMenuBar(NIL);
  114.         
  115.         FixAppleMenu (AppleMenuID);               {Add DAs to apple menu    }
  116.         height := FixMenuBar;                     {Set sizes of menus       }
  117.         DrawMenuBar;                              {...and draw the menu bar!}
  118.    end;    {of SetUpMenus}
  119.  
  120. END.
  121.